<template>
  <div class="tooltip">
    <a-tooltip placement="top" color="#fff">
      <template #title>
        {{ str }}
      </template>
      <div class="ellipsis-text" :style="textColor">{{ str }}</div>
    </a-tooltip>
  </div>
</template>

<script lang="ts" setup name="Tooltip">
type Props = { str: string; textColor?: string }
const props = defineProps<Props>()
const { str, textColor } = props
</script>

<style lang="less" scoped>
.tooltip {
  :deep(.ellipsis-text) {
    width: 154px;
    white-space: nowrap;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    cursor: pointer;
  }
}
</style>
